<%@ page language="java" import="java.util.*,com.hs.core.utils.*,com.hs.chd.action.search.*" pageEncoding="utf-8"%>
<%
String treedata = (String)request.getAttribute("treedata");
 
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head> 
<%@ include file="../../include.jsp"%> 
<link rel="stylesheet" href="<%=basePath %>thirtpart/ztree3.5/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
<script type="text/javascript" src="<%=basePath %>thirtpart/ztree3.5/js/jquery.ztree.core-3.5.min.js"></script>
<script type="text/javascript" src="<%=basePath %>thirtpart/ztree3.5/js/jquery.ztree.excheck-3.5.min.js"></script>
<script src="<%=basePath %>common/artDialog/artDialog.js?skin=blue"></script> 
<script type="text/javascript" src="<%=basePath %>common/artDialog/plugins/iframeTools.js"></script>
<style>.tac{text-align:center}</style>
<SCRIPT type="text/javascript">
		<!--
		var setting = {
			check: {
				enable: false
			}, 
			view: {
				showIcon: showIconForTree
			},
			data: {
				simpleData: {
					enable: true
				}
			}
			 ,
			callback: {
		         onCheck: zTreeOnCheck,
		         onClick: zTreeOnClick 
	        }
 		};
 		
 		function zTreeOnCheck(event, treeId, treeNode) {
   			 //alert(treeNode.id + ", " + treeNode.name + "," + treeNode.checked);
   			// window.parent.summindex.setHiddenDisname(treeNode.id,treeNode.name);
   			 //var treeObj = $.fn.zTree.getZTreeObj("tree");
			 //var nodes = treeObj.getCheckedNodes(true);
			  if(!treeNode.isParent)
			  viewContent(treeNode.name);
		};
		function zTreeOnClick(event, treeId, treeNode){
				//var treeObj = $.fn.zTree.getZTreeObj("treeboxbox_tree");
				 if(!treeNode.isParent)
                viewContent(treeNode.name);
			//alert(treeNode.tId + ", " + treeNode.name + "," + treeNode.checked);
		} 
		var zNodes =[
			<%=treedata%>
		];
		function showIconForTree(treeId, treeNode) {
			return !treeNode.isParent;
		};
		function viewContent(itemname) {  
			 
     		var selectedstr = document.getElementById("selectcontent").value;
     		var allstr = '';
     		if(selectedstr != ''){ 
     			if(selectedstr.indexOf(itemname)<0)
     			   allstr += selectedstr + ',' + itemname;
     			else
     				allstr = selectedstr;
     		}else{
     			allstr +=  itemname
     		}
     		document.getElementById("selectcontent").value = allstr;
        }
		$(document).ready(function(){
			$.fn.zTree.init($("#treeboxbox_tree"), setting, zNodes);
			var treeObj = $.fn.zTree.getZTreeObj("treeboxbox_tree"); 
			//treeObj.expandAll(true); 

		});
		
		function getCheckedvalues(){
			var treeObj = $.fn.zTree.getZTreeObj("treeboxbox_tree");
			var nodes = treeObj.getCheckedNodes(true);
            var idstr = "";
            if(nodes.length > 0){
            	for(var i=0;i<nodes.length;i++){
            		var id = nodes[i].id;
            		idstr += id;
            		if(i != nodes.length-1){
            			idstr+=',';
            		}
            	}
            	
            }  
            return idstr;
		}
		//-->
	</SCRIPT> 
<script language=JavaScript>  
function simpleCaseSearch(condition){ 
	simpleSearch(condition,'<%=basePath%>');
}
function comflexCaseSearch(condition){ 
	comflexSearch(condition,'<%=basePath%>');
}
function resetAll(){
	document.getElementById("selectcontent").value = "";
	
}
function setPvalue(){
	var disstr = document.getElementById("selectcontent").value;
	if('' == disstr){
		alert("请先选择疾病！");
		return;
	}
	parent.window.document.getElementById("disname").value=disstr;
	closeDialog();
}
function closeDialog(){
	
	art.dialog.close();
}
</script>
</head>
<body>
<div class="window" style="align:center">
 <div class="content">
    	<div class="pull-left" style="width:280px;">
        	<h4>疾病分类树</h4>
            <div class="select">
            	<div id="treeboxbox_tree" class="ztree" style="width:240px;margin-left:10px;overflow:auto;border:0px solid #bdc0c3;"></div>   

            </div>
        </div>
        <div class="pull-left" style="width:40px;">
        	 &nbsp;
        </div>
        <div class="pull-left" style="width:280px;">
        	<h4>已选择疾病</h4>
        	<div class="select">
            	<textarea rows="18" id="selectcontent" name="selectcontent" cols="41" style="align:center;border:none"></textarea>
            </div>
        </div>
    </div>
     <div class="foot"  > &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;
     &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;
           <input type="button" class="btn btn-primary" value="确定" onclick="setPvalue();"/>
           &nbsp;&nbsp;<input type="button" class="btn btn-primary" value="清空" onclick="resetAll();"/>
           </div>
</div>
</body>
</html>
